import { defineStore } from 'pinia'
export const menuStore = defineStore('menu', {
  state: () => {
    return {
      allMenu: [],
      childMenu: [],
    };
  },
  actions: {
    // 缓存所有菜单
    setAllMenu(list) {
      this.allMenu = list
    },
    // 缓存左侧菜单
    setChildMenu(list) {
      this.childMenu = list
    },
    // 清除菜单
    clearMenu() {
      this.allMenu = []
      this.childMenu = []
    }
  },
  persist: {
    enabled: true // true 表示开启持久化保存
  }
})